/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package to.pm.magazzino.core;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;
import to.pm.entity.personale.Dipendente;


/**
 *
 * @author
 */
public class RicercaDipendente {

    private EntityManager em;

    public List<Dipendente> findByNome(String nome) {
        Query createQuery = getEm().createQuery("select object(o) from Dipendente as o where o.nome like ?1");
        createQuery.setParameter(1, "%"+nome+"%");
        return createQuery.getResultList() ;
    }


    public void setEm(EntityManager em) {
        this.em = em;
    }

    public EntityManager getEm() {
        return em;
    }


}
